package com.oyb.filter;

import com.oyb.util.PropertiesUtils;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebFilter(urlPatterns = "/*")
public class Filter050encoding implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        String req_encoding = PropertiesUtils.getProperties("req_encoding");
        String resp_encoding = PropertiesUtils.getProperties("resp_encoding");
        servletRequest.setCharacterEncoding(req_encoding);
        servletRequest.setCharacterEncoding(resp_encoding);
        filterChain.doFilter(servletRequest,servletResponse);

    }

    @Override
    public void destroy() {

    }
}
